package com.cubeofnine.sugar.service.element;

import org.ksoap2.serialization.SoapObject;

public class ReturnAddContactList {
	private int insert_contact;
	private int duplicate_contact;
	private int total_contact;
	private ErrorValue error;

	public ReturnAddContactList() {
		super();
	}

	public ReturnAddContactList(int insert_contact, int duplicate_contact,
			int total_contact, ErrorValue error) {
		super();
		this.insert_contact = insert_contact;
		this.duplicate_contact = duplicate_contact;
		this.total_contact = total_contact;
		this.error = error;
	}

	public ReturnAddContactList(SoapObject obj) {
		try {
			String insert_contact = obj.getProperty("insert_contact")
					.toString();
			this.insert_contact = Integer.parseInt(insert_contact, 10);
		} catch (Exception e) {
			this.insert_contact = -1;
		}

		try {
			String duplicate_contact = obj.getProperty("duplicate_contact")
					.toString();
			this.duplicate_contact = Integer.parseInt(duplicate_contact, 10);
		} catch (Exception e) {
			this.duplicate_contact = -1;
		}

		try {
			String total_contact = obj.getProperty("total_contact").toString();
			this.total_contact = Integer.parseInt(total_contact, 10);
		} catch (Exception e) {
			this.total_contact = -1;
		}

		try {
			this.error = new ErrorValue((SoapObject) obj.getProperty("error"));
		} catch (Exception e) {
			this.error = null;
		}
	}

	public int getInsert_contact() {
		return insert_contact;
	}

	public void setInsert_contact(int insert_contact) {
		this.insert_contact = insert_contact;
	}

	public int getTotal_contact() {
		return total_contact;
	}

	public void setTotal_contact(int total_contact) {
		this.total_contact = total_contact;
	}

	public ErrorValue getError() {
		return error;
	}

	public void setError(ErrorValue error) {
		this.error = error;
	}

	public int getDuplicate_contact() {
		return duplicate_contact;
	}

	public void setDuplicate_contact(int duplicate_contact) {
		this.duplicate_contact = duplicate_contact;
	}

}
